!############################# Change Log ##################################
! 5.0.0
!
!###########################################################################
!  Copyright (C)  1990, 1995, 1999, 2000, 2003 - All Rights Reserved
!  Regional Atmospheric Modeling System - RAMS
!###########################################################################

subroutine masterput_processid(nproc,taskids,master_num)

  !   +------------------------------------------------------------------
  !   ! This routine gives basic processor ID info to the nodes.
  !   +------------------------------------------------------------------

  use rpara, only: &
       mainnum,    & ! INTENT(IN)
       nmachs,     & ! INTENT(IN)
       machnum       ! INTENT(IN)

  implicit none
  ! Arguments:
  integer, intent(in) :: nproc, master_num
  integer, intent(in) :: taskids(nproc)

  ! Local Variables:
  real, allocatable :: buff(:)
  integer :: nm, nwords, max_size, ipos

  mainnum = master_num
  nmachs  = nproc

  nwords= 4 + nmachs
  call parf_pack_max_size(nwords, max_size)
  allocate(buff(max_size))

  do nm=1,nmachs
     machnum(nm)=taskids(nm)
  enddo

  do nm=1,nmachs
     ipos = 1
     call parf_pack_int(mainnum, 1, buff, max_size, ipos)
     call parf_pack_int(machnum(nm), 1, buff, max_size, ipos)
     call parf_pack_int(nm, 1, buff, max_size, ipos)
     call parf_pack_int(nmachs, 1, buff, max_size, ipos)
     call parf_pack_int(machnum(1), nmachs, buff, max_size, ipos)
     call parf_send_block(buff, max_size, machnum(nm), 1)
  enddo

  deallocate(buff)

end subroutine masterput_processid

!-------------------------------------------------------------------------

subroutine masterput_nl()

  use mem_cuparm, only: &
       NNQPARM,         & ! INTENT(IN)
       WCLDBS,          & ! INTENT(IN)
       CONFRQ             ! INTENT(IN)

  use mem_grid

  use mem_leaf

  use mem_radiate

  use mem_turb

  use mem_varinit

  use mem_oda, only: &
       IF_ODA          ! INTENT(IN)

  use io_params

  use micphys

  use ref_sounding, only: &
       MAXSNDG       ! INTENT(IN)

  use rpara, only: &
       load_bal,   & ! INTENT(IN)
       nmachs,     & ! INTENT(IN)
       machnum       ! INTENT(IN)

  ! needed for Shallow Cumulus
  use shcu_vars_const, only : shcufrq,  & ! INTENT(IN)
       nnshcu                             ! INTENT(IN)

  ! For Grell Paramet.
  use mem_grell_param, only : CLOSURE_TYPE ! INTENT(IN)

  ! For SIB
  use sib_vars, only : N_CO2,  & ! INTENT(IN)
       CO2_INIT                  ! INTENT(IN)

  ! CATT
  use catt_start, only: CATT           ! intent(in)

  ! LFR: For extras user's arrays
  ! This values are parameters in BRAMS 4.0
  use extras,	   only: &
       na_extra2d,	 &  ! intent(in)
       na_extra3d		    ! intent(in)

  use mem_globrad, only: &
       RADDATFN             !, &   !  intent(in)
  !    RDATFNUM             !  intent(in)

!--(DMK-CCATT)---------------------------------------------------------
  !srf - chem
  use chem_sources, only: &
       plumerise, &
       prfrq,&
       def_proc_src, &
       SRCMAPFN
  use mem_chem1, only:  &
       nsrc, &
       chem1_src_z_dim_g,&
       CHEM_ASSIM, &
       CHEMISTRY,&
       CHEM_TIMESTEP,split_method,diur_cycle,nsrc
  use mem_chem1aq, only: &
       CHEMISTRY_AQ
  use mem_aer1, only: &
       AEROSOL
  !srf - chem - end
  !-srf checar uma vez que o mem_all ja usa o mem_stilt
  use mem_stilt, only : &
       iexev, &
       imassflx !INTENT(IN)
!--(DMK-original)------------------------------------------------------
!  use emission_source_map, only: &
!       plumerise            ! INTENT(IN)
!  use plume_utils, only: &
!       prfrq                ! INTENT(IN)
!--(DMK-CCATT-END)-----------------------------------------------------



  ! TEB_SPM
  use teb_spm_start, only: TEB_SPM           ! INTENT(IN)

  !For TEB_SPM
  use teb_vars_const, ONLY:  &
       iteb,TMINBLD,NTEB              & ! INTENT(IN)
       ,RUSHH1,RUSHH2,DAYLIGHT        & ! INTENT(IN)
       ,D_ROAD,TC_ROAD,HC_ROAD        & ! INTENT(IN)
       ,D_WALL,TC_WALL,HC_WALL        & ! INTENT(IN)
       ,D_ROOF,TC_ROOF,HC_ROOF        & ! INTENT(IN)
       ,NURBTYPE,ILEAFCOD,Z0_TOWN     & ! INTENT(IN)
       ,BLD,BLD_HEIGHT,BLD_HL_RATIO   & ! INTENT(IN)
       ,AROOF,EROOF,AROAD,EROAD       & ! INTENT(IN)
       ,AWALL,EWALL,HTRAF,HINDU       & ! INTENT(IN)
       ,PLETRAF,PLEINDU                 ! INTENT(IN)

  !For emission module - EDF
  use mem_emiss, only: &
       ICHEMI,         & ! INTENT(IN)
       ICHEMI_IN,      & ! INTENT(IN)
       CHEMDATA_IN,    & ! INTENT(IN)
       ISOURCE,        & ! INTENT(IN)
       WEEKDAYIN,      & ! INTENT(IN)
       EFSAT,          & ! INTENT(IN)
       EFSUN,          & ! INTENT(IN)
       EINDNO,         & ! INTENT(IN)
       EINDNO2,        & ! INTENT(IN)
       EINDPM ,        & ! INTENT(IN)
       EINDCO ,        & ! INTENT(IN)
       EINDSO2,        & ! INTENT(IN)
       EINDVOC,        & ! INTENT(IN)
       EVEINO ,        & ! INTENT(IN)
       EVEINO2,        & ! INTENT(IN)
       EVEIPM ,        & ! INTENT(IN)
       EVEICO ,        & ! INTENT(IN)
       EVEISO2,        & ! INTENT(IN)
       EVEIVOC           ! INTENT(IN)


  implicit none

  real, allocatable :: buff(:)
  integer :: nwords, nm, max_size, ipos, ialoc

  ! Total sum of words to send
  nwords = &
       4+ 3*MAXGRDS +2 + MAXGRDS +6 + NZPMAX +6 + 2*MAXGRDS +2 + 2*MAXGRDS + &
       2*MAXGRDS + 2*NZPMAX +2 + 7*MAXGRDS +6 +2 + 2*20 + 32*maxlite +11   + &
       maxgrds +8 + maxgrds +1 + maxgrds +1 + maxgrds +16 +1 + maxgrds + 1 + &
       MAXGRDS  + 2 + MAXGRDS + 2*NZGMAX + MAXGRDS + 4 + 1 + 160 +           &
       ! CATT
       4 +                                                                   &
       !
       1 +                                                                   &
       ! TEB_SPM
       6 + 9*MAXSTEB + 1 + 15*MAXUBTP + 2 + 80 + 1 + 3 + 14 +                &
       1 + 6 + 1 + MAXSNDG + 10 + 5 + MAXGRDS + 1 + 4*MAXGRDS +              &
       3 + 5 + 7 + 7 + 7 +                                                   &
       ! Extra
       100

!--(DMK-CCATT)---------------------------------------------------------
  !srf - chem
  nwords = nwords + 2  !for use extras arrays in CATT
  nwords = nwords + 4 !(CHEMISTRY, CHEM_ASSIM ,  prfrq, plumerise)
  nwords = nwords + nsrc*maxgrds !vertical dimension of source array
  nwords = nwords + 1 !(AEROSOL)
  nwords = nwords + 1 !(CHEMISTRY_AQ)
  nwords = nwords + 1 !(CHEM_TIMESTEP)
  nwords = nwords + 1 !(SPLIT_METHOD)
  nwords = nwords + 1 !(DEF_PROC_SRC)
  nwords = nwords + 1 !(SRCMAPFN)
  nwords = nwords + nsrc !(diur_cycle)
  !srf - chem - end
!--(DMK-CCATT-END)-----------------------------------------------------

  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size), stat=ialoc)

  ipos = 1
  call parf_pack_real(TIMMAX,1,buff(1),max_size,ipos)
  call parf_pack_int(if_adap,1,buff(1),max_size,ipos)
  call parf_pack_int(load_bal,1,buff(1),max_size,ipos)
  call parf_pack_int(NGRIDS,1,buff(1),max_size,ipos)
  call parf_pack_int(NNXP,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NNYP,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NNZP,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NZG,1,buff(1),max_size,ipos)
  call parf_pack_int(NZS,1,buff(1),max_size,ipos)
  call parf_pack_int(NXTNEST,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(IHTRAN,1,buff(1),max_size,ipos)
  call parf_pack_real(DELTAX,1,buff(1),max_size,ipos)
  call parf_pack_real(DELTAY,1,buff(1),max_size,ipos)
  call parf_pack_real(DELTAZ,1,buff(1),max_size,ipos)
  call parf_pack_real(DZRAT,1,buff(1),max_size,ipos)
  call parf_pack_real(DZMAX,1,buff(1),max_size,ipos)
  call parf_pack_real(ZZ,NZPMAX,buff(1),max_size,ipos)

  call parf_pack_int(IDELTAT,1,buff(1),max_size,ipos)
  call parf_pack_int(NACOUST,1,buff(1),max_size,ipos)
  call parf_pack_int(IMONTH1,1,buff(1),max_size,ipos)
  call parf_pack_int(IDATE1,1,buff(1),max_size,ipos)
  call parf_pack_int(IYEAR1,1,buff(1),max_size,ipos)
  call parf_pack_int(ITIME1,1,buff(1),max_size,ipos)

  call parf_pack_real(CENTLAT,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_real(CENTLON,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_real(POLELAT,1,buff(1),max_size,ipos)
  call parf_pack_real(POLELON,1,buff(1),max_size,ipos)
  call parf_pack_real(PLATN,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_real(PLONN,MAXGRDS,buff(1),max_size,ipos)

  call parf_pack_int(NSTRATX,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NSTRATY,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NSTRATZ1,NZPMAX,buff(1),max_size,ipos)
  call parf_pack_int(NSTRATZ2,NZPMAX,buff(1),max_size,ipos)
  call parf_pack_int(NESTZ1,1,buff(1),max_size,ipos)
  call parf_pack_int(NESTZ2,1,buff(1),max_size,ipos)
  call parf_pack_int(NINEST,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NJNEST,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NKNEST,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_real(GRIDU,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_real(GRIDV,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NNSTTOP,MAXGRDS,buff(1),max_size,ipos)
  call parf_pack_int(NNSTBOT,MAXGRDS,buff(1),max_size,ipos)

  call parf_pack_real(TIMSTR,1,buff(1),max_size,ipos)
  call parf_pack_int(IOUTPUT,1,buff(1),max_size,ipos)
  call parf_pack_int(INITFLD,1,buff(1),max_size,ipos)
  call parf_pack_real(FRQPRT,1,buff(1),max_size,ipos)
  call parf_pack_real(FRQHIS,1,buff(1),max_size,ipos)
  call parf_pack_real(FRQANL,1,buff(1),max_size,ipos)

  call parf_pack_real(FRQLITE,1,buff(1),max_size,ipos)
  call parf_pack_int(NLITE_VARS, 1,buff(1),max_size,ipos)              ! ALF - FOR LITE Vars.
  call parf_pack_char(XLITE(1:20), 20,buff,max_size,ipos)                 ! ALF - FOR LITE Vars.
  call parf_pack_char(YLITE(1:20), 20,buff,max_size,ipos)                 ! ALF - FOR LITE Vars.
  call parf_pack_char(ZLITE(1:20), 20,buff,max_size,ipos)                 ! ALF - FOR LITE Vars.
!!$  call parf_pack_char(LITE_VARS(1:32*maxlite), 32*maxlite,buff,max_size,ipos)     ! ALF - FOR LITE Vars.
  call parf_pack_char_vec(LITE_VARS, maxlite, 32, buff, max_size, ipos)     ! ALF - FOR LITE Vars.
  call parf_pack_real(FRQMEAN,1,buff,max_size,ipos)
  call parf_pack_real(FRQBOTH,1,buff,max_size,ipos)
  call parf_pack_real(AVGTIM,1,buff,max_size,ipos)
  call parf_pack_int(INITIAL,1,buff,max_size,ipos)
  call parf_pack_int(NUD_TYPE,1,buff,max_size,ipos)
  call parf_pack_int(IF_ODA,1,buff,max_size,ipos)
  call parf_pack_int(NUDLAT,1,buff,max_size,ipos)
  call parf_pack_real(TNUDLAT,1,buff,max_size,ipos)
  call parf_pack_real(TNUDTOP,1,buff,max_size,ipos)
  call parf_pack_real(TNUDCENT,1,buff,max_size,ipos)
  call parf_pack_real(ZNUDTOP,1,buff,max_size,ipos)
  call parf_pack_real(WT_NUDGE_GRID,maxgrds,buff,max_size,ipos)
  call parf_pack_real(WT_NUDGE_UV,1,buff,max_size,ipos)
  call parf_pack_real(WT_NUDGE_TH,1,buff,max_size,ipos)
  call parf_pack_real(WT_NUDGE_PI,1,buff,max_size,ipos)
  call parf_pack_real(WT_NUDGE_RT,1,buff,max_size,ipos)
  call parf_pack_int(NUD_COND,1,buff,max_size,ipos)
  call parf_pack_real(TCOND_BEG,1,buff,max_size,ipos)
  call parf_pack_real(TCOND_END,1,buff,max_size,ipos)
  call parf_pack_real(T_NUDGE_RC,1,buff,max_size,ipos)
  call parf_pack_real(WT_NUDGEC_GRID,maxgrds,buff,max_size,ipos)

  call parf_pack_int(IUPDSST,1,buff,max_size,ipos)

  call parf_pack_int(isstflg,maxgrds,buff,max_size,ipos) ! ALF - For local processing for comm_time

  call parf_pack_int(IUPDNDVI,1,buff,max_size,ipos)

  call parf_pack_int(ndviflg,maxgrds,buff,max_size,ipos) ! ALF - For local processing for comm_time

  call parf_pack_char(runtype(1:16),16,buff,max_size,ipos)  ! ALF - For local processing for comm_time

  call parf_pack_real(dtlong,1,buff,max_size,ipos) ! ALF - For local processing for dtset

  call parf_pack_int(NNDTRAT, maxgrds,buff,max_size,ipos)  ! ALF - For initial local processing for dtset

  call parf_pack_int(NADDSC,1,buff,max_size,ipos)
  call parf_pack_int(NNQPARM,MAXGRDS,buff,max_size,ipos)

  call parf_pack_char(CLOSURE_TYPE(1:2),2,buff,max_size,ipos) ! for new G.Grell Parameterization

  call parf_pack_int(NNSHCU,MAXGRDS,buff,max_size,ipos)  ! for Shallow Cumulus Param.

  call parf_pack_real(SLZ,NZGMAX,buff,max_size,ipos)
  call parf_pack_real(STGOFF,NZGMAX,buff,max_size,ipos)
  call parf_pack_real(SLMSTR,NZGMAX,buff,max_size,ipos)
  call parf_pack_int(IDIFFK,MAXGRDS,buff,max_size,ipos)
  call parf_pack_int(IHORGRAD,1,buff,max_size,ipos)
  call parf_pack_int(IF_URBAN_CANOPY,1,buff,max_size,ipos)
  call parf_pack_real(WCLDBS,1,buff,max_size,ipos)
  call parf_pack_real(CONFRQ,1,buff,max_size,ipos)

  call parf_pack_int(CATT, 1,buff,max_size,ipos)

  call parf_pack_char(RADDATFN(1:160),160,buff,max_size,ipos)
  !call parf_pack_int(RDATFNUM,1,buff,max_size,ipos)  ! Not used

  ! CATT
  if (CATT == 1) then
     ! This values are parameters
     call parf_pack_int(NA_EXTRA2D,1,buff,max_size,ipos) !LFR: Extras user's array ! Parameter in BRAMS 4.0
     call parf_pack_int(NA_EXTRA3D,1,buff,max_size,ipos) !LFR: Extras user's array ! Parameter in BRAMS 4.0


!--(DMK-CCATT)---------------------------------------------------------
     call parf_pack_int(PLUMERISE, 1,buff,max_size,ipos)
     call parf_pack_int(CHEM_ASSIM, 1,buff,max_size,ipos)
     call parf_pack_int(CHEMISTRY, 1,buff,max_size,ipos)
     call parf_pack_int(CHEMISTRY_AQ, 1,buff,max_size,ipos)
     call parf_pack_int(AEROSOL, 1,buff,max_size,ipos)
     call parf_pack_real(PRFRQ, 1,buff,max_size,ipos)
     call parf_pack_int(CHEM1_SRC_Z_DIM_G, nsrc*MAXGRDS,buff,max_size,ipos)


     call parf_pack_real(CHEM_TIMESTEP,       1,buff,max_size,ipos)
     call parf_pack_int (DIUR_CYCLE       ,nsrc,buff,max_size,ipos)
     call parf_pack_char(SPLIT_METHOD(1:20), 20,buff,max_size,ipos)    
     call parf_pack_char(DEF_PROC_SRC(1:32), 32,buff,max_size,ipos)    
     call parf_pack_char(SRCMAPFN(1:256), 256  ,buff,max_size,ipos)    

!--(DMK-CCATT-END)-----------------------------------------------------

  endif

  call parf_pack_int(TEB_SPM, 1,buff,max_size,ipos)

  ! TEB_SPM
  if (TEB_SPM==1) then
     CALL parf_pack_real(RUSHH1,1,buff,max_size,ipos)
     CALL parf_pack_real(RUSHH2,1,buff,max_size,ipos)
     CALL parf_pack_real(DAYLIGHT,1,buff,max_size,ipos)
     CALL parf_pack_int(ITEB,1,buff,max_size,ipos)
     CALL parf_pack_real(TMINBLD,1,buff,max_size,ipos)
     CALL parf_pack_int(NTEB,1,buff,max_size,ipos)
     CALL parf_pack_real(TC_ROOF,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(D_ROOF,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(HC_ROOF,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(HC_ROAD,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(TC_ROAD,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(D_ROAD,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(HC_WALL,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(TC_WALL,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_real(D_WALL,MAXSTEB,buff,max_size,ipos)
     CALL parf_pack_int(NURBTYPE,1,buff,max_size,ipos)
     CALL parf_pack_int(ILEAFCOD,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(Z0_TOWN,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(BLD,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(BLD_HEIGHT,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(BLD_HL_RATIO,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(AROOF,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(EROOF,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(AROAD,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(EROAD,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(AWALL,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(EWALL,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(HTRAF,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(HINDU,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(PLETRAF,MAXUBTP,buff,max_size,ipos)
     CALL parf_pack_real(PLEINDU,MAXUBTP,buff,max_size,ipos)
     
     CALL parf_pack_int(ICHEMI,1,buff,max_size,ipos)
     CALL parf_pack_int(ICHEMI_IN,1,buff,max_size,ipos)
     CALL parf_pack_char(CHEMDATA_IN(1:80),80,buff,max_size,ipos)
     CALL parf_pack_int(ISOURCE,1,buff,max_size,ipos)
     CALL parf_pack_char(WEEKDAYIN(1:3),3,buff,max_size,ipos)
     CALL parf_pack_real(EFSAT,1,buff,max_size,ipos)
     CALL parf_pack_real(EFSUN,1,buff,max_size,ipos)
     CALL parf_pack_real(EINDNO ,1,buff,max_size,ipos)
     CALL parf_pack_real(EINDNO2,1,buff,max_size,ipos)
     CALL parf_pack_real(EINDPM ,1,buff,max_size,ipos)
     CALL parf_pack_real(EINDCO ,1,buff,max_size,ipos)
     CALL parf_pack_real(EINDSO2,1,buff,max_size,ipos)
     CALL parf_pack_real(EINDVOC,1,buff,max_size,ipos)
     CALL parf_pack_real(EVEINO ,1,buff,max_size,ipos)
     CALL parf_pack_real(EVEINO2,1,buff,max_size,ipos)
     CALL parf_pack_real(EVEIPM ,1,buff,max_size,ipos)
     CALL parf_pack_real(EVEICO ,1,buff,max_size,ipos)
     CALL parf_pack_real(EVEISO2,1,buff,max_size,ipos)
     CALL parf_pack_real(EVEIVOC,1,buff,max_size,ipos)
  endif

  call parf_pack_real(SHCUFRQ,1,buff,max_size,ipos)     ! for Shallow Cumulus Param.

  call parf_pack_int(LSFLG,1,buff,max_size,ipos)
  call parf_pack_int(IBND,1,buff,max_size,ipos)
  call parf_pack_int(JBND,1,buff,max_size,ipos)
  call parf_pack_int(NPATCH,1,buff,max_size,ipos)
  call parf_pack_int(NVEGPAT,1,buff,max_size,ipos)
  call parf_pack_int(ISFCL,1,buff,max_size,ipos)

  call parf_pack_int(N_CO2,1,buff,max_size,ipos)             ! For SiB
  call parf_pack_real(CO2_INIT,MAXSNDG,buff,max_size,ipos)    ! For SiB

  call parf_pack_int(LONRAD,1,buff,max_size,ipos)
  call parf_pack_real(CPHAS,1,buff,max_size,ipos)
  call parf_pack_real(DISTIM,1,buff,max_size,ipos)
  call parf_pack_int(NFPT,1,buff,max_size,ipos)
  call parf_pack_real(DTHCON,1,buff,max_size,ipos)
  call parf_pack_real(DRTCON,1,buff,max_size,ipos)
  call parf_pack_real(SEATMP,1,buff,max_size,ipos)
  call parf_pack_real(PCTLCON,1,buff,max_size,ipos)
  call parf_pack_int(NSLCON,1,buff,max_size,ipos)
  call parf_pack_int(NVGCON,1,buff,max_size,ipos)

  call parf_pack_real(RADFRQ,1,buff,max_size,ipos)
  call parf_pack_real(ZROUGH,1,buff,max_size,ipos)
  call parf_pack_int(ILWRTYP,1,buff,max_size,ipos)
  call parf_pack_int(ISWRTYP,1,buff,max_size,ipos)
  call parf_pack_int(ICORFLG,1,buff,max_size,ipos)

!--(DMK-CCATT)---------------------------------------------------------
  ![ML
  call parf_pack_int(IEXEV,1,buff,max_size,ipos)
  call parf_pack_int(IMASSFLX,1,buff,max_size,ipos)
  !ML]
!--(DMK-CCATT-END)-----------------------------------------------------

  call parf_pack_real(AKMIN,MAXGRDS,buff,max_size,ipos)
  call parf_pack_real(ALBEDO,1,buff,max_size,ipos)
  call parf_pack_real(XKHKM,MAXGRDS,buff,max_size,ipos)
  call parf_pack_real(ZKHKM,MAXGRDS,buff,max_size,ipos)
  call parf_pack_real(CSZ,MAXGRDS,buff,max_size,ipos)
  call parf_pack_real(CSX,MAXGRDS,buff,max_size,ipos)
  call parf_pack_int(LEVEL,1,buff,max_size,ipos)
  call parf_pack_int(ICLOUD,1,buff,max_size,ipos)
  call parf_pack_int(IRAIN,1,buff,max_size,ipos)
  call parf_pack_int(IPRIS,1,buff,max_size,ipos)
  call parf_pack_int(ISNOW,1,buff,max_size,ipos)
  call parf_pack_int(IAGGR,1,buff,max_size,ipos)
  call parf_pack_int(IGRAUP,1,buff,max_size,ipos)
  call parf_pack_int(IHAIL,1,buff,max_size,ipos)
  call parf_pack_int(jnmb,7,buff,max_size,ipos)
  call parf_pack_real(RPARM,1,buff,max_size,ipos)
  call parf_pack_real(PPARM,1,buff,max_size,ipos)
  call parf_pack_real(SPARM,1,buff,max_size,ipos)
  call parf_pack_real(APARM,1,buff,max_size,ipos)
  call parf_pack_real(GPARM,1,buff,max_size,ipos)
  call parf_pack_real(HPARM,1,buff,max_size,ipos)
  call parf_pack_real(CPARM,1,buff,max_size,ipos)
  call parf_pack_real(GNU,7,buff,max_size,ipos)

  do nm=1,nmachs

     call parf_send_block(buff, max_size, machnum(nm), 2)

  enddo

  deallocate (buff)

end subroutine masterput_nl

!     ****************************************************************
!
subroutine masterput_gridinit()

  use mem_grid, only: &
       NNX,           & ! INTENT(IN)
       NNX1,          & ! INTENT(IN)
       NNX2,          & ! INTENT(IN)
       NNY,           & ! INTENT(IN)
       NNY1,          & ! INTENT(IN)
       NNY2,          & ! INTENT(IN)
       NNZ,           & ! INTENT(IN)
       NNXYZP,        & ! INTENT(IN)
       NNXYSP,        & ! INTENT(IN)
       NNXYP,         & ! INTENT(IN)
       JDIM             ! INTENT(IN)

  use rpara, only:    &
       maxgrds,       & ! INTENT(IN)
       nmachs,        & ! INTENT(IN)
       machnum          ! INTENT(IN)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, nm, max_size, ipos
  integer, parameter :: tag = 12

  nwords = 1 + 10 * maxgrds
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  call parf_pack_int(NNX,    MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNX1,   MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNX2,   MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNY,    MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNY1,   MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNY2,   MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNZ,    MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNXYZP, MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNXYSP, MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(NNXYP,  MAXGRDS, buff, max_size, ipos)
  call parf_pack_int(JDIM,   1,       buff, max_size, ipos)

  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  deallocate (buff)

end subroutine masterput_gridinit

!     ****************************************************************

subroutine masterput_grid_dimens

  use mem_grid, only: &
       ngrid,         & ! INTENT(IN)
       ngrids,        & ! INTENT(IN)
       nnzp             ! INTENT(IN)

  use cyclic_mod, only: &
       npts_cyc,        & ! INTENT(IN)
       ipathst_cyc,     & ! INTENT(IN)
       ipathsu_cyc,     & ! INTENT(IN)
       ipathsv_cyc        ! INTENT(IN)
  
  use rpara, only:         &
       maxgrds,            & ! INTENT(IN)
       maxmach,            & ! INTENT(IN)
       nmachs,             & ! INTENT(IN)
       nxend,              & ! INTENT(IN)
       nxbeg,              & ! INTENT(IN)
       nyend,              & ! INTENT(IN)
       nybeg,              & ! INTENT(IN)
       nxendc,             & ! INTENT(IN)
       nxbegc,             & ! INTENT(IN)
       nyendc,             & ! INTENT(IN)
       nybegc,             & ! INTENT(IN)
       ixoff,              & ! INTENT(IN)
       iyoff,              & ! INTENT(IN)
       ibcflg,             & ! INTENT(IN)
       machnum,            & ! INTENT(IN)
       ibounds,            & ! INTENT(IN)
       inode_paths_master, & ! INTENT(IN)
       iget_paths_master,  & ! INTENT(IN)
       lbc_buffs,          & ! INTENT(IN)
       newbuff_nest1,      & ! INTENT(IN)
       nbuff_nest1           ! INTENT(IN)

  implicit none
  real, allocatable :: buff(:)
  integer           :: nwords, nm, nxpts, nypts, nzpts, ipos, max_size, tag

  ! Total sum of words to send
  nwords = 8*maxgrds + 5*7*maxgrds*maxmach + 6*maxgrds*maxmach + 8*npts_cyc + &
       8*npts_cyc + 8*npts_cyc + 2*maxmach + 1 + 1 + 24 + 100 !(100 extra)
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  do nm=1,nmachs
     do ngrid=1,ngrids
        nxpts=nxend(nm,ngrid)-nxbeg(nm,ngrid)+1
        nypts=nyend(nm,ngrid)-nybeg(nm,ngrid)+1
        nzpts=nnzp(ngrid)
        call parf_pack_int(nxpts,            1, buff, max_size, ipos)
        call parf_pack_int(nypts,            1, buff, max_size, ipos)
        call parf_pack_int(nzpts,            1, buff, max_size, ipos)
        call parf_pack_int(nxbegc(nm,ngrid), 1, buff, max_size, ipos)
        call parf_pack_int(nxendc(nm,ngrid), 1, buff, max_size, ipos)
        call parf_pack_int(nybegc(nm,ngrid), 1, buff, max_size, ipos)
        call parf_pack_int(nyendc(nm,ngrid), 1, buff, max_size, ipos)
        call parf_pack_int(ixoff(nm,ngrid),  1, buff, max_size, ipos)
        call parf_pack_int(iyoff(nm,ngrid),  1, buff, max_size, ipos)
        call parf_pack_int(ibcflg(nm,ngrid), 1, buff, max_size, ipos)
     enddo
     call parf_pack_int(machnum(nm), 1, buff, max_size, ipos)
  enddo

  tag = 23
  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  tag = 24
  do nm=1,nmachs
     ! Reset the counter of words to send
     buff = 0.
     ipos = 1

     ! Reprod. - Saulo Barros
     call parf_pack_int(ibounds(1,1,nm), 8*maxgrds, buff, max_size, ipos)

     call parf_pack_int(inode_paths_master(1,1,1,1,nm), 5*7*maxgrds*maxmach, &
          buff, max_size, ipos)
     call parf_pack_int(iget_paths_master(1,1,1,nm),    6*maxgrds*maxmach,   &
          buff, max_size, ipos)

     !CALL parf_pack_int(ipathst_cyc,8*npts_cyc)
     if (allocated(ipathst_cyc)) &
          call parf_pack_int(ipathst_cyc, 8*npts_cyc, buff, max_size, ipos)

     !CALL parf_pack_int(ipathsu_cyc,8*npts_cyc)
     if (allocated(ipathsu_cyc)) &
          call parf_pack_int(ipathsu_cyc, 8*npts_cyc, buff, max_size, ipos)

     !CALL parf_pack_int(ipathsv_cyc,8*npts_cyc)
     if (allocated(ipathsv_cyc)) &
          call parf_pack_int(ipathsv_cyc, 8*npts_cyc, buff, max_size, ipos)

     call parf_pack_int(lbc_buffs(1,1,nm), 2*maxmach, buff, max_size, ipos)

     call parf_pack_int(newbuff_nest1(nm), 1,         buff, max_size, ipos)
     call parf_pack_int(nbuff_nest1(nm),   1,         buff, max_size, ipos)

     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  deallocate (buff)

end subroutine masterput_grid_dimens

!     ****************************************************************

subroutine masterput_gridset()

  use mem_grid, only: &
       nrz,           & !INTENT(IN)
       ipm,           & !INTENT(IN)
       jpm,           & !INTENT(IN)
       kpm,           & !INTENT(IN)
       xmn,           & !INTENT(IN)
       ymn,           & !INTENT(IN)
       zmn,           & !INTENT(IN)
       xtn,           & !INTENT(IN)
       ytn,           & !INTENT(IN)
       ztn,           & !INTENT(IN)
       dzmn,          & !INTENT(IN)
       dzm2n,         & !INTENT(IN)
       dztn,          & !INTENT(IN)
       dzt2n,         & !INTENT(IN)
       deltaxn,       & !INTENT(IN)
       deltayn,       & !INTENT(IN)
       deltazn,       & !INTENT(IN)
       ztop             !INTENT(IN)

  use rpara, only: &
       MAXGRDS,    & ! INTENT(IN)
       NZPMAX,     & ! INTENT(IN)
       NXPMAX,     & ! INTENT(IN)
       NYPMAX,     & ! INTENT(IN)
       NMACHS,     & ! INTENT(IN)
       MACHNUM       ! INTENT(IN)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, nm, max_size, ipos
  integer, parameter :: tag=35

  nwords=1+maxgrds*(3+8*nzpmax+3*(nxpmax+nypmax))
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  call parf_pack_int(nrz,      nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_int(ipm,      nxpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_int(jpm,      nypmax*maxgrds, buff, max_size, ipos)
  call parf_pack_int(kpm,      nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(xmn,     nxpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(ymn,     nypmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(zmn,     nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(xtn,     nxpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(ytn,     nypmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(ztn,     nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(dzmn,    nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(dzm2n,   nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(dztn,    nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(dzt2n,   nzpmax*maxgrds, buff, max_size, ipos)

  call parf_pack_real(deltaxn, maxgrds,        buff, max_size, ipos)
  call parf_pack_real(deltayn, maxgrds,        buff, max_size, ipos)
  call parf_pack_real(deltazn, maxgrds,        buff, max_size, ipos)

  call parf_pack_real(ztop,    1,              buff, max_size, ipos)

  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm),tag)
  enddo

  deallocate (buff)
end subroutine masterput_gridset
!
!     ****************************************************************
!
subroutine masterput_cofnest()

  use mem_grid, only: &
       ei1, & ! INTENT(IN)
       ei2, & ! INTENT(IN)
       ei3, & ! INTENT(IN)
       ei4, & ! INTENT(IN)
       ei5, & ! INTENT(IN)
       ei6, & ! INTENT(IN)
       ei7, & ! INTENT(IN)
       ej1, & ! INTENT(IN)
       ej2, & ! INTENT(IN)
       ej3, & ! INTENT(IN)
       ej4, & ! INTENT(IN)
       ej5, & ! INTENT(IN)
       ej6, & ! INTENT(IN)
       ej7, & ! INTENT(IN)
       ek1, & ! INTENT(IN)
       ek2, & ! INTENT(IN)
       ek3, & ! INTENT(IN)
       ek4, & ! INTENT(IN)
       ek5, & ! INTENT(IN)
       ek6, & ! INTENT(IN)
       ek7, & ! INTENT(IN)
       fbcf   ! INTENT(IN)

  use rpara, only: &
       maxgrds,    & ! INTENT(IN)
       nxpmax,     & ! INTENT(IN)
       nypmax,     & ! INTENT(IN)
       nzpmax,     & ! INTENT(IN)
       nmachs,     & ! INTENT(IN)
       machnum       ! INTENT(IN)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, nm, max_size, ipos
  integer, parameter :: tag=36

  nwords=maxgrds*(7*(nxpmax+nypmax)+11*nzpmax)
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  call parf_pack_real(ei1,  nxpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ei2,  nxpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ei3,  nxpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ei4,  nxpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ei5,  nxpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ei6,  nxpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ei7,  nxpmax*maxgrds,   buff, max_size, ipos)

  call parf_pack_real(ej1,  nypmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ej2,  nypmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ej3,  nypmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ej4,  nypmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ej5,  nypmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ej6,  nypmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ej7,  nypmax*maxgrds,   buff, max_size, ipos)

  call parf_pack_real(ek1,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ek2,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ek3,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ek4,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ek5,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ek6,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(ek7,  nzpmax*maxgrds,   buff, max_size, ipos)
  call parf_pack_real(fbcf, nzpmax*maxgrds*4, buff, max_size, ipos)

  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  deallocate (buff)

end subroutine masterput_cofnest

!     ****************************************************************

subroutine masterput_misc()

  use mem_grid, only: &
       NZPMAX,        & ! INTENT(IN)
       MAXGRDS,       & ! INTENT(IN)
       NSUBS,         & ! INTENT(IN)
       ITOPO,         & ! INTENT(IN)
       IMPL,          & ! INTENT(IN)
       IADVL,         & ! INTENT(IN)
       IADVF,         & ! INTENT(IN)
       TIME,          & ! INTENT(IN)
       HTN,           & ! INTENT(IN)
       HWN,           & ! INTENT(IN)
       HT2N,          & ! INTENT(IN)
       HT4N,          & ! INTENT(IN)
       HW2N,          & ! INTENT(IN)
       HW4N,          & ! INTENT(IN)
       HT,            & ! INTENT(IN)
       HW,            & ! INTENT(IN)
       HT2,           & ! INTENT(IN)
       HT4,           & ! INTENT(IN)
       HW2,           & ! INTENT(IN)
       HW4              ! INTENT(IN)

  use rpara, only: &
       nmachs,          & ! INTENT(IN)
       machnum            ! INTENT(IN)

  use mem_cuparm, only: &
       IF_CUINV,        & ! INTENT(IN)
       TNUDCU,          & ! INTENT(IN)
       WT_CU_GRID,      & ! INTENT(IN)
       TCU_BEG,         & ! INTENT(IN)
       TCU_END,         & ! INTENT(IN)
       CU_TIL,          & ! INTENT(IN)
       CU_TEL             ! INTENT(IN)

  use ref_sounding, only: &
       U01DN,             & ! INTENT(IN)
       V01DN,             & ! INTENT(IN)
       PI01DN,            & ! INTENT(IN)
       TH01DN,            & ! INTENT(IN)
       DN01DN,            & ! INTENT(IN)
       RT01DN               ! INTENT(IN)

  implicit none
  integer            :: nwords, nm, ipos, max_size
  real, allocatable  :: buff(:)
  integer, parameter :: tag=37

  nwords=12+12*nzpmax*maxgrds+6*nzpmax + 1*maxgrds
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  call parf_pack_int (nsubs,      1,              buff, max_size, ipos)
  call parf_pack_int (itopo,      1,              buff, max_size, ipos)
  call parf_pack_int (impl,       1,              buff, max_size, ipos)
  call parf_pack_int (iadvl,      1,              buff, max_size, ipos)
  call parf_pack_int (iadvf,      1,              buff, max_size, ipos)
  call parf_pack_real(time,       1,              buff, max_size, ipos)

  call parf_pack_real(u01dn,      nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(v01dn,      nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(pi01dn,     nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(th01dn,     nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(dn01dn,     nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(rt01dn,     nzpmax*maxgrds, buff, max_size, ipos)

  call parf_pack_real(htn,        nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(hwn,        nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(ht2n,       nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(ht4n,       nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(hw2n,       nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(hw4n,       nzpmax*maxgrds, buff, max_size, ipos)
  call parf_pack_real(ht,         nzpmax,         buff, max_size, ipos)
  call parf_pack_real(hw,         nzpmax,         buff, max_size, ipos)
  call parf_pack_real(ht2,        nzpmax,         buff, max_size, ipos)
  call parf_pack_real(ht4,        nzpmax,         buff, max_size, ipos)
  call parf_pack_real(hw2,        nzpmax,         buff, max_size, ipos)
  call parf_pack_real(hw4,        nzpmax,         buff, max_size, ipos)

  call parf_pack_int (if_cuinv,   1,              buff, max_size, ipos)
  call parf_pack_real(tnudcu,     1,              buff, max_size, ipos)
  call parf_pack_real(wt_cu_grid, maxgrds,        buff, max_size, ipos)
  call parf_pack_real(tcu_beg,    1,              buff, max_size, ipos)
  call parf_pack_real(tcu_end,    1,              buff, max_size, ipos)
  call parf_pack_real(cu_til,     1,              buff, max_size, ipos)
  call parf_pack_real(cu_tel,     1,              buff, max_size, ipos)


  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  deallocate (buff)

end subroutine masterput_misc
!
!     ****************************************************************
!
subroutine masterput_micphys()

  use micphys, only: &
       NCAT,         & ! INTENT(IN)
       NHCAT,        & ! INTENT(IN)
       NEMBC,        & ! INTENT(IN)
       NPAIRC,       & ! INTENT(IN)
       NPAIRR,       & ! INTENT(IN)
       VAR_SHAPE,    & ! INTENT(IN)
       CFMAS,        & ! INTENT(IN)
       PWMAS,        & ! INTENT(IN)
       CFVT,         & ! INTENT(IN)
       PWVT,         & ! INTENT(IN)
       EMB0,         & ! INTENT(IN)
       EMB1,         & ! INTENT(IN)
       COLTABC,      & ! INTENT(IN)
       COLTABR,      & ! INTENT(IN)
       IPAIRC,       & ! INTENT(IN)
       IPAIRR          ! INTENT(IN)

  use rpara, only: &
       nmachs,     & ! INTENT(IN)
       machnum       ! INTENT(IN)

  implicit none
  real, allocatable :: buff(:)
  integer :: nwords, nm, ipos, max_size
  integer, parameter :: tag=41

  nwords=2*ncat+nhcat*(5+2*nhcat)+nembc*nembc*(npairc+npairr)
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  call parf_pack_real(var_shape, nhcat,              buff, max_size, ipos)
  call parf_pack_real(cfmas,     nhcat,              buff, max_size, ipos)
  call parf_pack_real(pwmas,     nhcat,              buff, max_size, ipos)
  call parf_pack_real(cfvt,      nhcat,              buff, max_size, ipos)

  call parf_pack_real(pwvt,      nhcat,              buff, max_size, ipos)
  call parf_pack_real(emb0,      ncat,               buff, max_size, ipos)
  call parf_pack_real(emb1,      ncat,               buff, max_size, ipos)
  call parf_pack_real(coltabc,   nembc*nembc*npairc, buff, max_size, ipos)
  call parf_pack_real(coltabr,   nembc*nembc*npairr, buff, max_size, ipos)

  call parf_pack_int (ipairc,    nhcat*nhcat,        buff, max_size, ipos)
  call parf_pack_int (ipairr,    nhcat*nhcat,        buff, max_size, ipos)

  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  deallocate (buff)
end subroutine masterput_micphys

! *************************************************************************

subroutine nodeget_processid(init)

  use node_mod, only: &
       MASTER_NUM,    & ! INTENT(OUT)
       MCHNUM,        & ! INTENT(OUT)
       MYNUM,         & ! INTENT(OUT)
       NMACHS,        & ! INTENT(OUT)
       MACHS            ! INTENT(OUT)

 use grid_dims, only: &
       maxmach           ! INTENT(IN)

  implicit none
  ! Arguments:
  integer, intent(in) :: init
  
  ! Local Variables:
  real, allocatable :: buff(:)
  integer :: nwords, max_size, ipos

  if(init==1) then

     !          get process identifying info from the master process
     nwords=4+maxmach
     call parf_pack_max_size(nwords, max_size)
     allocate (buff(max_size))

     call parf_get_block(buff, max_size, 0, 1)
     ipos = 1
     call parf_unpack_int(buff, max_size, ipos, master_num, 1)
     call parf_unpack_int(buff, max_size, ipos, mchnum, 1)
     call parf_unpack_int(buff, max_size, ipos, mynum, 1)
     call parf_unpack_int(buff, max_size, ipos, nmachs, 1)
     call parf_unpack_int(buff, max_size, ipos, machs, nmachs)

     deallocate(buff)

  endif

end subroutine nodeget_processid

!     ****************************************************************

subroutine nodeget_nl()

  use mem_cuparm, only: &
       NNQPARM,         & ! INTENT(OUT)
       WCLDBS,          & ! INTENT(OUT)
       CONFRQ             ! INTENT(OUT)

  use mem_grid

  use mem_leaf

  use mem_radiate

  use mem_turb

  use mem_varinit

  use mem_oda, only: &
       IF_ODA          ! INTENT(OUT)

  use io_params

  use micphys

  use ref_sounding, only: &
       MAXSNDG       ! INTENT(OUT)

  use node_mod, only : &
       master_num,     & ! INTENT(OUT)
       load_bal          ! INTENT(OUT)

  ! needed for Shallow Cumulus
  use shcu_vars_const, only : shcufrq,  & ! INTENT(OUT)
       nnshcu                             ! INTENT(OUT)

  ! For Grell Paramet.
  use mem_grell_param, only : CLOSURE_TYPE ! INTENT(OUT)

  ! For SIB
  use sib_vars, only : N_CO2,  & ! INTENT(OUT)
       CO2_INIT                  ! INTENT(OUT)

  ! CATT
  use catt_start, only: &
       CATT            ! intent(out)

  ! LFR: For extras user's arrays
  ! This variables are parameters in BRAMS 4.0
  use extras, only: &
       na_extra2d,  &  ! intent(out)
       na_extra3d      ! intent(out)

  use mem_globrad, only: &
       RADDATFN        !, &   !  intent(out)
  !    RDATFNUM        !  intent(out) - Not Used

!--(DMK-CCATT)---------------------------------------------------------
  !srf -chem
  use chem_sources, only: &
       plumerise, &
       prfrq,DEF_PROC_SRC,SRCMAPFN
  use mem_chem1, only:  &
       nsrc, &
       chem1_src_z_dim_g, &
       CHEM_ASSIM, &
       CHEMISTRY,&
       CHEM_TIMESTEP, SPLIT_METHOD,diur_cycle,nsrc
 use mem_chem1aq, only: &
       CHEMISTRY_AQ
  use mem_aer1, only: &
       AEROSOL
  !srf -chem
  !-srf checar uma vez que o mem_all ja inclui o use mem_stilt
  USE mem_stilt, ONLY : &
       iexev, &
       imassflx !INTENT(OUT)
!--(DMK-original)------------------------------------------------------
!  use emission_source_map, only: &
!       plumerise            ! INTENT(IN)
!  use plume_utils, only: &
!       prfrq                ! INTENT(IN)
!--(DMK-CCATT-END)-----------------------------------------------------


  use teb_spm_start,   only: &
       TEB_SPM             ! INTENT(OUT)

  !For TEB_SPM
  use teb_vars_const, ONLY:  &
       iteb,TMINBLD,NTEB              & ! INTENT(OUT)
       ,RUSHH1,RUSHH2,DAYLIGHT        & ! INTENT(OUT)
       ,D_ROAD,TC_ROAD,HC_ROAD        & ! INTENT(OUT)
       ,D_WALL,TC_WALL,HC_WALL        & ! INTENT(OUT)
       ,D_ROOF,TC_ROOF,HC_ROOF        & ! INTENT(OUT)
       ,NURBTYPE,ILEAFCOD,Z0_TOWN     & ! INTENT(OUT)
       ,BLD,BLD_HEIGHT,BLD_HL_RATIO   & ! INTENT(OUT)
       ,AROOF,EROOF,AROAD,EROAD       & ! INTENT(OUT)
       ,AWALL,EWALL,HTRAF,HINDU       & ! INTENT(OUT)
       ,PLETRAF,PLEINDU                 ! INTENT(OUT)

  !For emission module - EDF
  use mem_emiss, only: &
       ICHEMI,         & ! INTENT(OUT)
       ICHEMI_IN,      & ! INTENT(OUT)
       CHEMDATA_IN,    & ! INTENT(OUT)
       ISOURCE,        & ! INTENT(OUT)
       WEEKDAYIN,      & ! INTENT(OUT)
       EFSAT,          & ! INTENT(OUT)
       EFSUN,          & ! INTENT(OUT)
       EINDNO,         & ! INTENT(OUT)
       EINDNO2,        & ! INTENT(OUT)
       EINDPM ,        & ! INTENT(OUT)
       EINDCO ,        & ! INTENT(OUT)
       EINDSO2,        & ! INTENT(OUT)
       EINDVOC,        & ! INTENT(OUT)
       EVEINO ,        & ! INTENT(OUT)
       EVEINO2,        & ! INTENT(OUT)
       EVEIPM ,        & ! INTENT(OUT)
       EVEICO ,        & ! INTENT(OUT)
       EVEISO2,        & ! INTENT(OUT)
       EVEIVOC           ! INTENT(OUT)


  implicit none
  real, allocatable :: buff(:)
  integer :: nwords, max_size, ipos, ialoc

  ! Total lenght of words to receive
  nwords = &
       4 + 3*MAXGRDS + 2 + MAXGRDS + 6 + NZPMAX + 6 + 2*MAXGRDS + 2 + 2*MAXGRDS + &
       2*MAXGRDS + 2*NZPMAX + 2 + 7*MAXGRDS + 6 + 2 + 2*20 + 32*maxlite + 11 + &
       maxgrds + 8 + maxgrds + 1 + maxgrds + 1 + maxgrds + 16 + 1 + maxgrds + 1 + &
       MAXGRDS  + 2 + MAXGRDS + 2*NZGMAX + MAXGRDS + 4 + 1 + 160 + &
       ! CATT
       4 + &
       !
       1 + &
       ! TEB_SPM
       6 + 9*MAXSTEB + 1 + 15*MAXUBTP + 2 + 80 + 1 + 3 + 14 + &
       !
       1 + 6 + 1 + MAXSNDG + 10 + 5 + MAXGRDS + 1 + 4*MAXGRDS + 3 + 5 + 7 + 7 + 7 + &
       ! Extra
       100

!--(DMK-CCATT)---------------------------------------------------------
  !srf - chem
  nwords = nwords + 2  !for use extras arrays in CATT
  nwords = nwords + 4 !(CHEMISTRY, CHEM_ASSIM ,  prfrq, plumerise)
  nwords = nwords + nsrc*maxgrds !vertical dimension of source array
  nwords = nwords + 1 !(AEROSOL)
  nwords = nwords + 1 !(CHEMISTRY_AQ)
  nwords = nwords + 1 !(CHEM_TIMESTP)
  nwords = nwords + 1 !(SPLIT_METHOD)
  nwords = nwords + 1 !(DEF_PROC_SRC)
  nwords = nwords + 1 !(SRCMAPFN)
  nwords = nwords + nsrc !(diur_cycle)
  !srf - chem - end
!--(DMK-CCATT-END)-----------------------------------------------------

  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size), stat=ialoc)

  call parf_get_block(buff(1), max_size, master_num, 2)

  ipos = 1
  call parf_unpack_real(buff(1),max_size,ipos,TIMMAX,1)
  call parf_unpack_int(buff(1),max_size,ipos,if_adap,1)
  call parf_unpack_int(buff(1),max_size,ipos,load_bal,1)
  call parf_unpack_int(buff(1),max_size,ipos,NGRIDS,1)
  call parf_unpack_int(buff(1),max_size,ipos,NNXP,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NNYP,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NNZP,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NZG,1)
  call parf_unpack_int(buff(1),max_size,ipos,NZS,1)
  call parf_unpack_int(buff(1),max_size,ipos,NXTNEST,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,IHTRAN,1)
  call parf_unpack_real(buff(1),max_size,ipos,DELTAX,1)
  call parf_unpack_real(buff(1),max_size,ipos,DELTAY,1)
  call parf_unpack_real(buff(1),max_size,ipos,DELTAZ,1)
  call parf_unpack_real(buff(1),max_size,ipos,DZRAT,1)
  call parf_unpack_real(buff(1),max_size,ipos,DZMAX,1)
  call parf_unpack_real(buff(1),max_size,ipos,ZZ,NZPMAX)

  call parf_unpack_int(buff(1),max_size,ipos,IDELTAT,1)
  call parf_unpack_int(buff(1),max_size,ipos,NACOUST,1)
  call parf_unpack_int(buff(1),max_size,ipos,IMONTH1,1)
  call parf_unpack_int(buff(1),max_size,ipos,IDATE1,1)
  call parf_unpack_int(buff(1),max_size,ipos,IYEAR1,1)
  call parf_unpack_int(buff(1),max_size,ipos,ITIME1,1)

  call parf_unpack_real(buff(1),max_size,ipos,CENTLAT,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,CENTLON,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,POLELAT,1)
  call parf_unpack_real(buff(1),max_size,ipos,POLELON,1)
  call parf_unpack_real(buff(1),max_size,ipos,PLATN,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,PLONN,MAXGRDS)

  call parf_unpack_int(buff(1),max_size,ipos,NSTRATX,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NSTRATY,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NSTRATZ1,NZPMAX)
  call parf_unpack_int(buff(1),max_size,ipos,NSTRATZ2,NZPMAX)
  call parf_unpack_int(buff(1),max_size,ipos,NESTZ1,1)
  call parf_unpack_int(buff(1),max_size,ipos,NESTZ2,1)
  call parf_unpack_int(buff(1),max_size,ipos,NINEST,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NJNEST,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NKNEST,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,GRIDU,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,GRIDV,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NNSTTOP,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,NNSTBOT,MAXGRDS)

  call parf_unpack_real(buff(1),max_size,ipos,TIMSTR,1)
  call parf_unpack_int(buff(1),max_size,ipos,IOUTPUT,1)
  call parf_unpack_int(buff(1),max_size,ipos,INITFLD,1)
  call parf_unpack_real(buff(1),max_size,ipos,FRQPRT,1)
  call parf_unpack_real(buff(1),max_size,ipos,FRQHIS,1)
  call parf_unpack_real(buff(1),max_size,ipos,FRQANL,1)

  call parf_unpack_real(buff(1),max_size,ipos,FRQLITE,1)
  call parf_unpack_int(buff(1),max_size,ipos,NLITE_VARS,1) ! ALF - FOR LITE Vars.
  call parf_unpack_char(buff(1),max_size,ipos,XLITE(1:20), 20)                 ! ALF - FOR LITE Vars.
  call parf_unpack_char(buff(1),max_size,ipos,YLITE(1:20), 20)                 ! ALF - FOR LITE Vars.
  call parf_unpack_char(buff(1),max_size,ipos,ZLITE(1:20), 20)                 ! ALF - FOR LITE Vars.
!!$  call parf_unpack_char(buff(1),max_size,ipos,LITE_VARS(1:32*maxlite), 32*maxlite)     ! ALF - FOR LITE Vars.
  call parf_unpack_char_vec(buff(1), max_size, ipos, LITE_VARS, maxlite, 32)     ! ALF - FOR LITE Vars.

  call parf_unpack_real(buff(1),max_size,ipos,FRQMEAN,1)
  call parf_unpack_real(buff(1),max_size,ipos,FRQBOTH,1)
  call parf_unpack_real(buff(1),max_size,ipos,AVGTIM,1)
  call parf_unpack_int(buff(1),max_size,ipos,INITIAL,1)
  call parf_unpack_int(buff(1),max_size,ipos,NUD_TYPE,1)
  call parf_unpack_int(buff(1),max_size,ipos,IF_ODA,1)
  call parf_unpack_int(buff(1),max_size,ipos,NUDLAT,1)
  call parf_unpack_real(buff(1),max_size,ipos,TNUDLAT,1)
  call parf_unpack_real(buff(1),max_size,ipos,TNUDTOP,1)
  call parf_unpack_real(buff(1),max_size,ipos,TNUDCENT,1)
  call parf_unpack_real(buff(1),max_size,ipos,ZNUDTOP,1)
  call parf_unpack_real(buff(1),max_size,ipos,WT_NUDGE_GRID,maxgrds)
  call parf_unpack_real(buff(1),max_size,ipos,WT_NUDGE_UV,1)
  call parf_unpack_real(buff(1),max_size,ipos,WT_NUDGE_TH,1)
  call parf_unpack_real(buff(1),max_size,ipos,WT_NUDGE_PI,1)
  call parf_unpack_real(buff(1),max_size,ipos,WT_NUDGE_RT,1)
  call parf_unpack_int(buff(1),max_size,ipos,NUD_COND,1)
  call parf_unpack_real(buff(1),max_size,ipos,TCOND_BEG,1)
  call parf_unpack_real(buff(1),max_size,ipos,TCOND_END,1)
  call parf_unpack_real(buff(1),max_size,ipos,T_NUDGE_RC,1)
  call parf_unpack_real(buff(1),max_size,ipos,WT_NUDGEC_GRID,maxgrds)

  call parf_unpack_int(buff(1),max_size,ipos,IUPDSST,1)

  call parf_unpack_int(buff(1),max_size,ipos,isstflg,maxgrds) ! ALF - For local processing for comm_time

  call parf_unpack_int(buff(1),max_size,ipos,IUPDNDVI,1)

  call parf_unpack_int(buff(1),max_size,ipos,ndviflg,maxgrds) ! ALF - For local processing for comm_time

  call parf_unpack_char(buff(1),max_size,ipos,runtype(1:16),16)  ! ALF - For local processing for comm_time

  call parf_unpack_real(buff(1),max_size,ipos,dtlong,1) ! ALF - For local processing for dtset

  call parf_unpack_int(buff(1),max_size,ipos,NNDTRAT, maxgrds)  ! ALF - For initial local processing for dtset

  call parf_unpack_int(buff(1),max_size,ipos,NADDSC,1)
  call parf_unpack_int(buff(1),max_size,ipos,NNQPARM,MAXGRDS)

  call parf_unpack_char(buff(1),max_size,ipos,CLOSURE_TYPE(1:2),2) ! for new G.Grell Parameterization

  call parf_unpack_int(buff(1),max_size,ipos,NNSHCU,MAXGRDS)  ! for Shallow Cumulus Param.

  call parf_unpack_real(buff(1),max_size,ipos,SLZ,NZGMAX)
  call parf_unpack_real(buff(1),max_size,ipos,STGOFF,NZGMAX)
  call parf_unpack_real(buff(1),max_size,ipos,SLMSTR,NZGMAX)
  call parf_unpack_int(buff(1),max_size,ipos,IDIFFK,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,IHORGRAD,1)
  call parf_unpack_int(buff(1),max_size,ipos,IF_URBAN_CANOPY,1)
  call parf_unpack_real(buff(1),max_size,ipos,WCLDBS,1)
  call parf_unpack_real(buff(1),max_size,ipos,CONFRQ,1)

  call parf_unpack_int(buff(1),max_size,ipos,CATT, 1)

  call parf_unpack_char(buff(1),max_size,ipos,RADDATFN(1:160),160)
  ! call parf_unpack_int(buff(1),max_size,ipos,RDATFNUM,1) ! Not used

  ! CATT
  if (CATT == 1) then

     call parf_unpack_int(buff(1),max_size,ipos,NA_EXTRA2D,1) !LFR: Extras user's array ! Parameter in BRAMS 4.0
     call parf_unpack_int(buff(1),max_size,ipos,NA_EXTRA3D,1) !LFR: Extras user's array ! Parameter in BRAMS 4.0

!--(DMK-CCATT)---------------------------------------------------------
     call parf_unpack_int(buff(1), max_size, ipos, PLUMERISE, 1)
     call parf_unpack_int(buff(1), max_size, ipos, CHEM_ASSIM, 1)
     call parf_unpack_int(buff(1), max_size, ipos, CHEMISTRY, 1)
     call parf_unpack_int(buff(1), max_size, ipos, CHEMISTRY_AQ, 1)
     call parf_unpack_int(buff(1), max_size, ipos, AEROSOL, 1)
     call parf_unpack_real(buff(1), max_size, ipos, prfrq, 1)
     call parf_unpack_int(buff(1), max_size, ipos, chem1_src_z_dim_g, nsrc*MAXGRDS)
     
     call parf_unpack_real(buff(1), max_size, ipos, CHEM_TIMESTEP, 1)
     call parf_unpack_int(buff(1), max_size, ipos, diur_cycle, nsrc)
     call parf_unpack_char(buff(1),max_size,ipos,SPLIT_METHOD(1:20), 20)    
     call parf_unpack_char(buff(1),max_size,ipos,DEF_PROC_SRC(1:32), 32)    
     call parf_unpack_char(buff(1),max_size,ipos,SRCMAPFN(1:256), 256)    
    
!--(DMK-CCATT-END)-----------------------------------------------------

  endif

  call parf_unpack_int(buff(1),max_size,ipos,TEB_SPM, 1)

  ! TEB
  if (TEB_SPM==1) then
     CALL parf_unpack_real(buff(1),max_size,ipos,RUSHH1,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,RUSHH2,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,DAYLIGHT,1)
     CALL parf_unpack_int(buff(1),max_size,ipos,ITEB,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,TMINBLD,1)
     CALL parf_unpack_int(buff(1),max_size,ipos,NTEB,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,TC_ROOF,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,D_ROOF,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,HC_ROOF,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,HC_ROAD,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,TC_ROAD,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,D_ROAD,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,HC_WALL,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,TC_WALL,MAXSTEB)
     CALL parf_unpack_real(buff(1),max_size,ipos,D_WALL,MAXSTEB)
     CALL parf_unpack_int(buff(1),max_size,ipos,NURBTYPE,1)
     CALL parf_unpack_int(buff(1),max_size,ipos,ILEAFCOD,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,Z0_TOWN,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,BLD,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,BLD_HEIGHT,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,BLD_HL_RATIO,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,AROOF,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,EROOF,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,AROAD,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,EROAD,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,AWALL,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,EWALL,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,HTRAF,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,HINDU,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,PLETRAF,MAXUBTP)
     CALL parf_unpack_real(buff(1),max_size,ipos,PLEINDU,MAXUBTP)
     
     CALL parf_unpack_int(buff(1),max_size,ipos,ICHEMI,1)
     CALL parf_unpack_int(buff(1),max_size,ipos,ICHEMI_IN,1)
     CALL parf_unpack_char(buff(1),max_size,ipos,CHEMDATA_IN(1:80),80)
     CALL parf_unpack_int(buff(1),max_size,ipos,ISOURCE,1)
     CALL parf_unpack_char(buff(1),max_size,ipos,WEEKDAYIN(1:3),3)
     CALL parf_unpack_real(buff(1),max_size,ipos,EFSAT,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EFSUN,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EINDNO ,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EINDNO2,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EINDPM ,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EINDCO ,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EINDSO2,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EINDVOC,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EVEINO ,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EVEINO2,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EVEIPM ,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EVEICO ,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EVEISO2,1)
     CALL parf_unpack_real(buff(1),max_size,ipos,EVEIVOC,1)
  endif

  call parf_unpack_real(buff(1),max_size,ipos,SHCUFRQ,1)     ! for Shallow Cumulus Param.

  call parf_unpack_int(buff(1),max_size,ipos,LSFLG,1)
  call parf_unpack_int(buff(1),max_size,ipos,IBND,1)
  call parf_unpack_int(buff(1),max_size,ipos,JBND,1)
  call parf_unpack_int(buff(1),max_size,ipos,NPATCH,1)
  call parf_unpack_int(buff(1),max_size,ipos,NVEGPAT,1)
  call parf_unpack_int(buff(1),max_size,ipos,ISFCL,1)

  call parf_unpack_int(buff(1),max_size,ipos,N_CO2,1)             ! For SiB
  call parf_unpack_real(buff(1),max_size,ipos,CO2_INIT,MAXSNDG)    ! For SiB

  call parf_unpack_int(buff(1),max_size,ipos,LONRAD,1)
  call parf_unpack_real(buff(1),max_size,ipos,CPHAS,1)
  call parf_unpack_real(buff(1),max_size,ipos,DISTIM,1)
  call parf_unpack_int(buff(1),max_size,ipos,NFPT,1)
  call parf_unpack_real(buff(1),max_size,ipos,DTHCON,1)
  call parf_unpack_real(buff(1),max_size,ipos,DRTCON,1)
  call parf_unpack_real(buff(1),max_size,ipos,SEATMP,1)
  call parf_unpack_real(buff(1),max_size,ipos,PCTLCON,1)
  call parf_unpack_int(buff(1),max_size,ipos,NSLCON,1)
  call parf_unpack_int(buff(1),max_size,ipos,NVGCON,1)

  call parf_unpack_real(buff(1),max_size,ipos,RADFRQ,1)
  call parf_unpack_real(buff(1),max_size,ipos,ZROUGH,1)
  call parf_unpack_int(buff(1),max_size,ipos,ILWRTYP,1)
  call parf_unpack_int(buff(1),max_size,ipos,ISWRTYP,1)
  call parf_unpack_int(buff(1),max_size,ipos,ICORFLG,1)

!--(DMK-CCATT)---------------------------------------------------------
  ![ML
  call parf_unpack_int(buff(1), max_size, ipos, IEXEV, 1)
  call parf_unpack_int(buff(1), max_size, ipos, IMASSFLX, 1)
  !ML]
!--(DMK-CCATT-END)-----------------------------------------------------

  call parf_unpack_real(buff(1),max_size,ipos,AKMIN,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,ALBEDO,1)
  call parf_unpack_real(buff(1),max_size,ipos,XKHKM,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,ZKHKM,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,CSZ,MAXGRDS)
  call parf_unpack_real(buff(1),max_size,ipos,CSX,MAXGRDS)
  call parf_unpack_int(buff(1),max_size,ipos,LEVEL,1)
  call parf_unpack_int(buff(1),max_size,ipos,ICLOUD,1)
  call parf_unpack_int(buff(1),max_size,ipos,IRAIN,1)

  call parf_unpack_int(buff(1),max_size,ipos,IPRIS,1)
  call parf_unpack_int(buff(1),max_size,ipos,ISNOW,1)
  call parf_unpack_int(buff(1),max_size,ipos,IAGGR,1)
  call parf_unpack_int(buff(1),max_size,ipos,IGRAUP,1)
  call parf_unpack_int(buff(1),max_size,ipos,IHAIL,1)
  call parf_unpack_int(buff(1),max_size,ipos,jnmb,7)
  call parf_unpack_real(buff(1),max_size,ipos,RPARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,PPARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,SPARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,APARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,GPARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,HPARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,CPARM,1)
  call parf_unpack_real(buff(1),max_size,ipos,GNU,7)

  deallocate (buff)

end subroutine nodeget_nl


!     ****************************************************************

subroutine nodeget_gridinit()

  use mem_grid, only: &
       NNX,           & ! INTENT(OUT)
       NNX1,          & ! INTENT(OUT)
       NNX2,          & ! INTENT(OUT)
       NNY,           & ! INTENT(OUT)
       NNY1,          & ! INTENT(OUT)
       NNY2,          & ! INTENT(OUT)
       NNZ,           & ! INTENT(OUT)
       NNXYZP,        & ! INTENT(OUT)
       NNXYSP,        & ! INTENT(OUT)
       NNXYP,         & ! INTENT(OUT)
       JDIM             ! INTENT(OUT)

  use node_mod, only: &
       master_num       ! INTENT(IN)

  use grid_dims, only: &
       maxgrds           ! INTENT(IN)

  implicit none
  real, allocatable :: buff(:)
  integer :: nwords,ibytes,msgtype,ihostnum, ipos, max_size
  integer, parameter :: tag=12

  nwords = 1 + 10 * maxgrds
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  call parf_unpack_int(buff, max_size, ipos, NNX,    MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNX1,   MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNX2,   MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNY,    MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNY1,   MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNY2,   MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNZ,    MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNXYZP, MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNXYSP, MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, NNXYP,  MAXGRDS)
  call parf_unpack_int(buff, max_size, ipos, JDIM,   1)

  deallocate (buff)

end subroutine nodeget_gridinit
!
!     ****************************************************************
!
subroutine nodeget_grid_dimens()

  use mem_grid, only: &
       ngrids           ! INTENT(IN)

  use grid_dims, only: &
       maxgrds           ! INTENT(IN)

  use node_mod, only: &
       mynum,         & ! INTENT(IN)
       master_num,    & ! INTENT(IN)
       nmachs,        & ! INTENT(IN)
       nodemxp,       & ! INTENT(OUT)
       nodemyp,       & ! INTENT(OUT)
       nodemzp,       & ! INTENT(OUT)
       nodeia,        & ! INTENT(OUT)
       nodeiz,        & ! INTENT(OUT)
       nodeja,        & ! INTENT(OUT)
       nodejz,        & ! INTENT(OUT)
       nodei0,        & ! INTENT(OUT)
       nodej0,        & ! INTENT(OUT)
       nodeibcon,     & ! INTENT(OUT)
       machs,         & ! INTENT(OUT)
       nodebounds,    & ! INTENT(OUT)
       ipaths,        & ! INTENT(OUT)
       iget_paths,    & ! INTENT(OUT)
       node_buffs,    & ! INTENT(OUT)
       newbuff_nest,  & ! INTENT(OUT)
       nbuff_nest,    & ! INTENT(OUT)
       mmxp,          & ! INTENT(OUT)
       mmyp,          & ! INTENT(OUT)
       mmzp,          & ! INTENT(OUT)
       mia,           & ! INTENT(OUT)
       miz,           & ! INTENT(OUT)
       mja,           & ! INTENT(OUT)
       mjz,           & ! INTENT(OUT)
       mi0,           & ! INTENT(OUT)
       mj0,           & ! INTENT(OUT)
       mibcon           ! INTENT(OUT)

  use cyclic_mod, only: &
       maxmach,         & ! INTENT(IN)
       npts_cyc,        & ! INTENT(IN)
       ipathst_cyc,     & ! INTENT(IN)
       ipathsu_cyc,     & ! INTENT(IN)
       ipathsv_cyc        ! INTENT(IN)

  implicit none
  real, allocatable :: buff(:)
  integer           :: nwords, nm, ng, ipos, max_size, tag

  !        get gridpoint information from the master process

  ! Total sum of words to receive
  nwords = 8*maxgrds + 5*7*maxgrds*maxmach + 6*maxgrds*maxmach + 8*npts_cyc + &
       8*npts_cyc + 8*npts_cyc + 2*maxmach + 1 + 1 + 24 + 100 !(100 extra)
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  tag = 23
  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  do nm=1,nmachs
     do ng=1,ngrids
        call parf_unpack_int(buff, max_size, ipos, nodemxp(nm,ng),   1)

        call parf_unpack_int(buff, max_size, ipos, nodemyp(nm,ng),   1)
        call parf_unpack_int(buff, max_size, ipos, nodemzp(nm,ng),   1)
        call parf_unpack_int(buff, max_size, ipos, nodeia(nm,ng),    1)
        call parf_unpack_int(buff, max_size, ipos, nodeiz(nm,ng),    1)
        call parf_unpack_int(buff, max_size, ipos, nodeja(nm,ng),    1)
        call parf_unpack_int(buff, max_size, ipos, nodejz(nm,ng),    1)
        call parf_unpack_int(buff, max_size, ipos, nodei0(nm,ng),    1)
        call parf_unpack_int(buff, max_size, ipos, nodej0(nm,ng),    1)
        call parf_unpack_int(buff, max_size, ipos, nodeibcon(nm,ng), 1)
     enddo
     call parf_unpack_int(buff, max_size, ipos, machs(nm), 1)
  enddo


  tag = 24
  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  ! Reprod. - Saulo Barros
  call parf_unpack_int(buff, max_size, ipos, nodebounds, 8*maxgrds)

  call parf_unpack_int(buff, max_size, ipos, ipaths,     5*7*maxgrds*maxmach)
  call parf_unpack_int(buff, max_size, ipos, iget_paths, 6*maxgrds*maxmach)

  !CALL parf_unpack_int(ipathst_cyc,8*npts_cyc)
  if (allocated(ipathst_cyc)) &
       call parf_unpack_int(buff, max_size, ipos, ipathst_cyc, 8*npts_cyc)

  !CALL parf_unpack_int(ipathsu_cyc,8*npts_cyc)
  if (allocated(ipathsu_cyc)) &
       call parf_unpack_int(buff, max_size, ipos, ipathsu_cyc, 8*npts_cyc)

  !CALL parf_unpack_int(ipathsv_cyc,8*npts_cyc)
  if (allocated(ipathsv_cyc)) &
       call parf_unpack_int(buff, max_size, ipos, ipathsv_cyc, 8*npts_cyc)

  do nm=1,maxmach
     call parf_unpack_int(buff, max_size, ipos, node_buffs(nm)%nsend, 1)
     call parf_unpack_int(buff, max_size, ipos, node_buffs(nm)%nrecv, 1)
  enddo

  call parf_unpack_int(buff, max_size, ipos, newbuff_nest, 1)
  call parf_unpack_int(buff, max_size, ipos, nbuff_nest,   1)

  deallocate (buff)

  do ng=1,ngrids
     mmxp(ng)=nodemxp(mynum,ng)
     mmyp(ng)=nodemyp(mynum,ng)
     mmzp(ng)=nodemzp(mynum,ng)
     mia(ng)=nodeia(mynum,ng)
     miz(ng)=nodeiz(mynum,ng)
     mja(ng)=nodeja(mynum,ng)
     mjz(ng)=nodejz(mynum,ng)
     mi0(ng)=nodei0(mynum,ng)
     mj0(ng)=nodej0(mynum,ng)
     mibcon(ng)=nodeibcon(mynum,ng)

  enddo

end subroutine nodeget_grid_dimens
!
!     ****************************************************************
!
subroutine nodeget_gridset()

  use mem_grid, only: &
       nrz,           & !INTENT(OUT)
       ipm,           & !INTENT(OUT)
       jpm,           & !INTENT(OUT)
       kpm,           & !INTENT(OUT)
       xmn,           & !INTENT(OUT)
       ymn,           & !INTENT(OUT)
       zmn,           & !INTENT(OUT)
       xtn,           & !INTENT(OUT)
       ytn,           & !INTENT(OUT)
       ztn,           & !INTENT(OUT)
       dzmn,          & !INTENT(OUT)
       dzm2n,         & !INTENT(OUT)
       dztn,          & !INTENT(OUT)
       dzt2n,         & !INTENT(OUT)
       deltaxn,       & !INTENT(OUT)
       deltayn,       & !INTENT(OUT)
       deltazn,       & !INTENT(OUT)
       ztop             !INTENT(OUT)

  use grid_dims, only: &
       nzpmax,         & ! INTENT(IN)
       nxpmax,         & ! INTENT(IN)
       nypmax            ! INTENT(IN)

  use node_mod, only: &
       master_num        ! INTENT(IN)

  use grid_dims, only: &
       maxgrds           ! INTENT(IN)

  implicit none

  real, allocatable  :: buff(:)
  integer            :: nwords, ipos, max_size
  integer, parameter :: tag=35

  nwords=1+maxgrds*(3+8*nzpmax+3*(nxpmax+nypmax))
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  call parf_unpack_int (buff, max_size, ipos, nrz,     nzpmax*maxgrds)
  call parf_unpack_int (buff, max_size, ipos, ipm,     nxpmax*maxgrds)
  call parf_unpack_int (buff, max_size, ipos, jpm,     nypmax*maxgrds)
  call parf_unpack_int (buff, max_size, ipos, kpm,     nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, xmn,     nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ymn,     nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, zmn,     nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, xtn,     nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ytn,     nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ztn,     nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, dzmn,    nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, dzm2n,   nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, dztn,    nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, dzt2n,   nzpmax*maxgrds)

  call parf_unpack_real(buff, max_size, ipos, deltaxn, maxgrds)
  call parf_unpack_real(buff, max_size, ipos, deltayn, maxgrds)
  call parf_unpack_real(buff, max_size, ipos, deltazn, maxgrds)

  call parf_unpack_real(buff, max_size, ipos, ztop,    1)

  deallocate (buff)
end subroutine nodeget_gridset
!
!     ****************************************************************
!
subroutine nodeget_cofnest()

   use mem_grid, only: &
       ei1, & ! INTENT(OUT)
       ei2, & ! INTENT(OUT)
       ei3, & ! INTENT(OUT)
       ei4, & ! INTENT(OUT)
       ei5, & ! INTENT(OUT)
       ei6, & ! INTENT(OUT)
       ei7, & ! INTENT(OUT)
       ej1, & ! INTENT(OUT)
       ej2, & ! INTENT(OUT)
       ej3, & ! INTENT(OUT)
       ej4, & ! INTENT(OUT)
       ej5, & ! INTENT(OUT)
       ej6, & ! INTENT(OUT)
       ej7, & ! INTENT(OUT)
       ek1, & ! INTENT(OUT)
       ek2, & ! INTENT(OUT)
       ek3, & ! INTENT(OUT)
       ek4, & ! INTENT(OUT)
       ek5, & ! INTENT(OUT)
       ek6, & ! INTENT(OUT)
       ek7, & ! INTENT(OUT)
       fbcf   ! INTENT(OUT)

  use node_mod, only: &
       master_num       ! INTENT(IN)

  use grid_dims, only: &
       maxgrds,        & ! INTENT(IN)
       nzpmax,         & ! INTENT(IN)
       nxpmax,         & ! INTENT(IN)
       nypmax            ! INTENT(IN)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, ipos, max_size
  integer, parameter :: tag=36

  nwords=maxgrds*(7*(nxpmax+nypmax)+11*nzpmax)
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  call parf_unpack_real(buff, max_size, ipos, ei1,  nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ei2,  nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ei3,  nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ei4,  nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ei5,  nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ei6,  nxpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ei7,  nxpmax*maxgrds)

  call parf_unpack_real(buff, max_size, ipos, ej1,  nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ej2,  nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ej3,  nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ej4,  nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ej5,  nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ej6,  nypmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ej7,  nypmax*maxgrds)

  call parf_unpack_real(buff, max_size, ipos, ek1,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ek2,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ek3,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ek4,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ek5,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ek6,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ek7,  nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, fbcf, nzpmax*maxgrds*4)

  deallocate (buff)
end subroutine nodeget_cofnest

!     ****************************************************************

subroutine nodeget_misc()

  use mem_grid, only: &
       NZPMAX,        & ! INTENT(IN)
       MAXGRDS,       & ! INTENT(IN)
       NSUBS,         & ! INTENT(OUT)
       ITOPO,         & ! INTENT(OUT)
       IMPL,          & ! INTENT(OUT)
       IADVL,         & ! INTENT(OUT)
       IADVF,         & ! INTENT(OUT)
       TIME,          & ! INTENT(OUT)
       HTN,           & ! INTENT(OUT)
       HWN,           & ! INTENT(OUT)
       HT2N,          & ! INTENT(OUT)
       HT4N,          & ! INTENT(OUT)
       HW2N,          & ! INTENT(OUT)
       HW4N,          & ! INTENT(OUT)
       HT,            & ! INTENT(OUT)
       HW,            & ! INTENT(OUT)
       HT2,           & ! INTENT(OUT)
       HT4,           & ! INTENT(OUT)
       HW2,           & ! INTENT(OUT)
       HW4              ! INTENT(OUT)

  use mem_cuparm, only: &
       IF_CUINV,        & ! INTENT(OUT)
       TNUDCU,          & ! INTENT(OUT)
       WT_CU_GRID,      & ! INTENT(OUT)
       TCU_BEG,         & ! INTENT(OUT)
       TCU_END,         & ! INTENT(OUT)
       CU_TIL,          & ! INTENT(OUT)
       CU_TEL             ! INTENT(OUT)

  use ref_sounding, only: &
       U01DN,             & ! INTENT(OUT)
       V01DN,             & ! INTENT(OUT)
       PI01DN,            & ! INTENT(OUT)
       TH01DN,            & ! INTENT(OUT)
       DN01DN,            & ! INTENT(OUT)
       RT01DN               ! INTENT(OUT)

  use node_mod, only: &
       master_num       ! INTENT(IN)

  implicit none
  integer            :: nwords, max_size, ipos
  real, allocatable  :: buff(:)
  integer, parameter :: tag=37

  nwords=12 + 12*nzpmax*maxgrds + 6*nzpmax + 1*maxgrds
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  call parf_unpack_int (buff, max_size, ipos, nsubs,      1)
  call parf_unpack_int (buff, max_size, ipos, itopo,      1)
  call parf_unpack_int (buff, max_size, ipos, impl,       1)
  call parf_unpack_int (buff, max_size, ipos, iadvl,      1)
  call parf_unpack_int (buff, max_size, ipos, iadvf,      1)
  call parf_unpack_real(buff, max_size, ipos, time,       1)

  call parf_unpack_real(buff, max_size, ipos, u01dn,      nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, v01dn,      nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, pi01dn,     nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, th01dn,     nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, dn01dn,     nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, rt01dn,     nzpmax*maxgrds)

  call parf_unpack_real(buff, max_size, ipos, htn,        nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, hwn,        nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ht2n,       nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ht4n,       nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, hw2n,       nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, hw4n,       nzpmax*maxgrds)
  call parf_unpack_real(buff, max_size, ipos, ht,         nzpmax)
  call parf_unpack_real(buff, max_size, ipos, hw,         nzpmax)
  call parf_unpack_real(buff, max_size, ipos, ht2,        nzpmax)
  call parf_unpack_real(buff, max_size, ipos, ht4,        nzpmax)
  call parf_unpack_real(buff, max_size, ipos, hw2,        nzpmax)
  call parf_unpack_real(buff, max_size, ipos, hw4,        nzpmax)

  call parf_unpack_int (buff, max_size, ipos, if_cuinv,   1)
  call parf_unpack_real(buff, max_size, ipos, tnudcu,     1)
  call parf_unpack_real(buff, max_size, ipos, wt_cu_grid, maxgrds)
  call parf_unpack_real(buff, max_size, ipos, tcu_beg,    1)
  call parf_unpack_real(buff, max_size, ipos, tcu_end,    1)
  call parf_unpack_real(buff, max_size, ipos, cu_til,     1)
  call parf_unpack_real(buff, max_size, ipos, cu_tel,     1)

  deallocate (buff)

  return
end subroutine nodeget_misc
!
!     ****************************************************************
!
subroutine nodeget_micphys()

  use micphys, only: &
       NCAT,         & ! INTENT(OUT)
       NHCAT,        & ! INTENT(OUT)
       NEMBC,        & ! INTENT(OUT)
       NPAIRC,       & ! INTENT(OUT)
       NPAIRR,       & ! INTENT(OUT)
       VAR_SHAPE,    & ! INTENT(OUT)
       CFMAS,        & ! INTENT(OUT)
       PWMAS,        & ! INTENT(OUT)
       CFVT,         & ! INTENT(OUT)
       PWVT,         & ! INTENT(OUT)
       EMB0,         & ! INTENT(OUT)
       EMB1,         & ! INTENT(OUT)
       COLTABC,      & ! INTENT(OUT)
       COLTABR,      & ! INTENT(OUT)
       IPAIRC,       & ! INTENT(OUT)
       IPAIRR          ! INTENT(OUT)

  use node_mod, only: &
       master_num       ! INTENT(IN)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, ipos, max_size
  integer, parameter :: tag=41

  nwords=2*ncat+nhcat*(5+2*nhcat)+nembc*nembc*(npairc+npairr)
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  call parf_unpack_real(buff, max_size, ipos, var_shape, nhcat)
  call parf_unpack_real(buff, max_size, ipos, cfmas,     nhcat)
  call parf_unpack_real(buff, max_size, ipos, pwmas,     nhcat)
  call parf_unpack_real(buff, max_size, ipos, cfvt,      nhcat)
  call parf_unpack_real(buff, max_size, ipos, pwvt,      nhcat)

  call parf_unpack_real(buff, max_size, ipos, emb0,      ncat)
  call parf_unpack_real(buff, max_size, ipos, emb1,      ncat)
  call parf_unpack_real(buff, max_size, ipos, coltabc,   nembc*nembc*npairc)
  call parf_unpack_real(buff, max_size, ipos, coltabr,   nembc*nembc*npairr)
  call parf_unpack_int (buff, max_size, ipos, ipairc,    nhcat*nhcat)
  call parf_unpack_int (buff, max_size, ipos, ipairr,    nhcat*nhcat)

  deallocate (buff)
end subroutine nodeget_micphys

!     ****************************************************************

subroutine masterput_carma()

  use mem_globrad, only: & ! INTENT(IN)
       nirp, ngauss, ntotal, nwave, nsol, nsolp, &
       o3mixp,pj,ako3,akco2,akh2o,contnm,gangle, &
       gratio,gweight,weight,treal,ttmag,nprob,  &
       pso2,pso3,psh2o,psco2,wave,solfx,xah2o, &
       xaco2,xao2,xao3,ta,tb,wa,wb,ga,gb,tia,tib, &
       wia,wib,gia,gib,alpha,gama,caseE,caseW,caseG, &
       sq3,jdble,jn,tpi,cpcon,fdegday

  use rpara, only: &
       nmachs, & ! Intent(in)
       machnum   ! Intent(in)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, nm, ipos, max_size
  integer, parameter :: tag=43

  nwords=6 + 6 + 4*6 + 6*6 + 54*6 + nirp + 3*ngauss + ntotal + 2*(2*nwave) + &
       ntotal + 4*ntotal + nwave+1 + nsol + 4*nsolp + 14*ntotal + 3*(9*nwave) +&
       6 + &
       ! Extra
       100
  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  ipos = 1
  call parf_pack_real(o3mixp,  6,       buff, max_size, ipos)
  call parf_pack_real(pj,      6,       buff, max_size, ipos)
  call parf_pack_real(ako3,    4*6,     buff, max_size, ipos)
  call parf_pack_real(akco2,   6*6,     buff, max_size, ipos)
  call parf_pack_real(akh2o,   54*6,    buff, max_size, ipos)
  call parf_pack_real(contnm,  nirp,    buff, max_size, ipos)
  call parf_pack_real(gangle,  ngauss,  buff, max_size, ipos)
  call parf_pack_real(gratio,  ngauss,  buff, max_size, ipos)
  call parf_pack_real(gweight, ngauss,  buff, max_size, ipos)
  call parf_pack_real(weight,  ntotal,  buff, max_size, ipos)
  call parf_pack_real(treal,   2*nwave, buff, max_size, ipos)
  call parf_pack_real(ttmag,   2*nwave, buff, max_size, ipos)
  call parf_pack_real(nprob,   ntotal,  buff, max_size, ipos)
  call parf_pack_real(pso2,    ntotal,  buff, max_size, ipos)
  call parf_pack_real(pso3,    ntotal,  buff, max_size, ipos)
  call parf_pack_real(psh2o,   ntotal,  buff, max_size, ipos)
  call parf_pack_real(psco2,   ntotal,  buff, max_size, ipos)
  call parf_pack_real(wave,    nwave+1, buff, max_size, ipos)
  call parf_pack_real(solfx,   nsol,    buff, max_size, ipos)
  call parf_pack_real(xah2o,   nsolp,   buff, max_size, ipos)
  call parf_pack_real(xaco2,   nsolp,   buff, max_size, ipos)
  call parf_pack_real(xao2,    nsolp,   buff, max_size, ipos)
  call parf_pack_real(xao3,    nsolp,   buff, max_size, ipos)
  call parf_pack_real(ta,      ntotal,  buff, max_size, ipos)
  call parf_pack_real(tb,      ntotal,  buff, max_size, ipos)
  call parf_pack_real(wa,      ntotal,  buff, max_size, ipos)
  call parf_pack_real(wb,      ntotal,  buff, max_size, ipos)
  call parf_pack_real(ga,      ntotal,  buff, max_size, ipos)
  call parf_pack_real(gb,      ntotal,  buff, max_size, ipos)
  call parf_pack_real(tia,     ntotal,  buff, max_size, ipos)
  call parf_pack_real(tib,     ntotal,  buff, max_size, ipos)
  call parf_pack_real(wia,     ntotal,  buff, max_size, ipos)
  call parf_pack_real(wib,     ntotal,  buff, max_size, ipos)
  call parf_pack_real(gia,     ntotal,  buff, max_size, ipos)
  call parf_pack_real(gib,     ntotal,  buff, max_size, ipos)
  call parf_pack_real(alpha,   ntotal,  buff, max_size, ipos)
  call parf_pack_real(gama,    ntotal,  buff, max_size, ipos)
  call parf_pack_real(caseE,   9*nwave, buff, max_size, ipos)
  call parf_pack_real(caseW,   9*nwave, buff, max_size, ipos)
  call parf_pack_real(caseG,   9*nwave, buff, max_size, ipos)
  call parf_pack_real(sq3,     1,       buff, max_size, ipos)
  call parf_pack_int (jdble,   1,       buff, max_size, ipos)
  call parf_pack_int (jn,      1,       buff, max_size, ipos)
  call parf_pack_real(tpi,     1,       buff, max_size, ipos)
  call parf_pack_real(cpcon,   1,       buff, max_size, ipos)
  call parf_pack_real(fdegday, 1,       buff, max_size, ipos)

  do nm=1,nmachs
     call parf_send_block(buff, max_size, machnum(nm), tag)
  enddo

  deallocate (buff)

end subroutine masterput_carma

!
!     ****************************************************************
!
subroutine nodeget_carma()

  use mem_globrad, only: & ! INTENT(OUT)
       nirp, ngauss, ntotal, nwave, nsol, nsolp, &
       o3mixp,pj,ako3,akco2,akh2o,contnm,gangle, &
       gratio,gweight,weight,treal,ttmag,nprob,  &
       pso2,pso3,psh2o,psco2,wave,solfx,xah2o, &
       xaco2,xao2,xao3,ta,tb,wa,wb,ga,gb,tia,tib, &
       wia,wib,gia,gib,alpha,gama,caseE,caseW,caseG, &
       sq3,jdble,jn,tpi,cpcon,fdegday

  use node_mod, only: &
       master_num       ! INTENT(IN)

  implicit none
  real, allocatable  :: buff(:)
  integer            :: nwords, ipos, max_size
  integer, parameter :: tag=43

  nwords=6 + 6 + 4*6 + 6*6 + 54*6 + nirp + 3*ngauss + ntotal + 2*(2*nwave) + &
       ntotal + 4*ntotal + nwave+1 + nsol + 4*nsolp + 14*ntotal + 3*(9*nwave) +&
       6 + &
       ! Extra
       100

  call parf_pack_max_size(nwords, max_size)
  allocate (buff(max_size))

  call parf_get_block(buff, max_size, master_num, tag)

  ipos = 1
  call parf_unpack_real(buff, max_size, ipos, o3mixp, 6)
  call parf_unpack_real(buff, max_size, ipos, pj, 6)
  call parf_unpack_real(buff, max_size, ipos, ako3, 4*6)
  call parf_unpack_real(buff, max_size, ipos, akco2, 6*6)
  call parf_unpack_real(buff, max_size, ipos, akh2o, 54*6)
  call parf_unpack_real(buff, max_size, ipos, contnm, nirp)
  call parf_unpack_real(buff, max_size, ipos, gangle, ngauss)
  call parf_unpack_real(buff, max_size, ipos, gratio, ngauss)
  call parf_unpack_real(buff, max_size, ipos, gweight, ngauss)
  call parf_unpack_real(buff, max_size, ipos, weight, ntotal)
  call parf_unpack_real(buff, max_size, ipos, treal, 2*nwave)
  call parf_unpack_real(buff, max_size, ipos, ttmag, 2*nwave)
  call parf_unpack_real(buff, max_size, ipos, nprob, ntotal)
  call parf_unpack_real(buff, max_size, ipos, pso2, ntotal)
  call parf_unpack_real(buff, max_size, ipos, pso3, ntotal)
  call parf_unpack_real(buff, max_size, ipos, psh2o, ntotal)
  call parf_unpack_real(buff, max_size, ipos, psco2, ntotal)
  call parf_unpack_real(buff, max_size, ipos, wave, (nwave+1))
  call parf_unpack_real(buff, max_size, ipos, solfx, nsol)
  call parf_unpack_real(buff, max_size, ipos, xah2o, nsolp)
  call parf_unpack_real(buff, max_size, ipos, xaco2, nsolp)
  call parf_unpack_real(buff, max_size, ipos, xao2, nsolp)
  call parf_unpack_real(buff, max_size, ipos, xao3, nsolp)
  call parf_unpack_real(buff, max_size, ipos, ta, ntotal)
  call parf_unpack_real(buff, max_size, ipos, tb, ntotal)
  call parf_unpack_real(buff, max_size, ipos, wa, ntotal)
  call parf_unpack_real(buff, max_size, ipos, wb, ntotal)
  call parf_unpack_real(buff, max_size, ipos, ga, ntotal)
  call parf_unpack_real(buff, max_size, ipos, gb, ntotal)
  call parf_unpack_real(buff, max_size, ipos, tia, ntotal)
  call parf_unpack_real(buff, max_size, ipos, tib, ntotal)
  call parf_unpack_real(buff, max_size, ipos, wia, ntotal)
  call parf_unpack_real(buff, max_size, ipos, wib, ntotal)
  call parf_unpack_real(buff, max_size, ipos, gia, ntotal)
  call parf_unpack_real(buff, max_size, ipos, gib, ntotal)
  call parf_unpack_real(buff, max_size, ipos, alpha, ntotal)
  call parf_unpack_real(buff, max_size, ipos, gama, ntotal)
  call parf_unpack_real(buff, max_size, ipos, caseE, (9*nwave))
  call parf_unpack_real(buff, max_size, ipos, caseW, (9*nwave))
  call parf_unpack_real(buff, max_size, ipos, caseG, (9*nwave))
  call parf_unpack_real(buff, max_size, ipos, sq3, 1)
  call parf_unpack_int (buff, max_size, ipos, jdble, 1)
  call parf_unpack_int (buff, max_size, ipos, jn, 1)
  call parf_unpack_real(buff, max_size, ipos, tpi, 1)
  call parf_unpack_real(buff, max_size, ipos, cpcon, 1)
  call parf_unpack_real(buff, max_size, ipos, fdegday, 1)  

  deallocate (buff)

end subroutine nodeget_carma
